home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / alpha / examples / Thread.d < prev    next >
Encoding:
Text File  |  2002-10-28  |  637 b   |  30 lines

  1. MODULE 'dos/dos','dos/dostags','dos/dosextens','utility/tagitem'
  2.  
  3. PROC main()
  4.   -> pointer to the thread process
  5.   DEF mythread:PTR TO Process
  6.  
  7.   -> create a thread process
  8.   IF mythread:=CreateNewProc(
  9.     [
  10.     NP_Entry,&thread, -> where the thread process begins
  11.     NP_Name,'MyThread', -> the thread process name
  12.     TAG_DONE
  13.     ])
  14.  
  15.   ENDIF
  16.   Delay(50)
  17.  
  18.   -> IMPORTANT: the main process may never end when threads are running.
  19.   -> In this small example, we simply wait a while, which is NOT RIGHT!!
  20.   Delay(50)
  21.  
  22. ENDPROC
  23.  
  24. PROC thread()
  25.  
  26.   WriteF('Hello, it\as me, your newly created thread.\n')
  27.   WriteF('I stopped now\n')
  28.  
  29. ENDPROC
  30.